package serviceImpl;



import dao.BackUserDao;

import daoImpl.BackUserDaoImpl;

import pojo.BackUser;
import service.BackUserService;


public class BackUserServiceImpl implements BackUserService {
	/*
	 ************************************注册部分***********************************
	 */
	@Override
	public boolean checkPhoneNumber(String userPhoneNumber) {
		BackUserDao ud = new BackUserDaoImpl();
		BackUser u = ud.getUserByUserPhoneNum(userPhoneNumber);
		return u!=null ? false : true;
	}

	@Override
	public boolean saveUser(BackUser user) {
		BackUserDao ud = new BackUserDaoImpl();
		int row = ud.savaUser(user);
		return row>0 ? true : false;
	}

	@Override
	public boolean checkUserName(String userName) {
		BackUserDao ud = new BackUserDaoImpl();
		BackUser user = ud.getUserByUserName(userName);
		return user != null ? false : true;
	}
	
	/*
	 ************************************登入部分***********************************
	 */
	@Override
	public boolean checkNamePsw(String userName, String password) {
		BackUserDao ud = new BackUserDaoImpl();
		BackUser user = ud.getUserByNamePsw(userName,password);
		return user !=null ? true : false;
	}
	

	


	



}
